<template>
    <div class="newCar">
        <div class="common_br">
            <h2 class="common_title extra_title">资产信息
                <span v-show="!isShowDetails&&!isAssertChange" @click="save('newCar')" class="saveBtn">保存</span>
            </h2>
            <div class="common_content">
                <Row>
                    <Col span="8">
                        <FormItem label="品牌" prop="brandName" class="iconsearch_style">
                            <div  @click="tagSearch">
                                <Input v-model="optionForm.brandName" :disabled="(isdisabled&&diffType=='details')||isReconsider" placeholder="点击款式查询后自动带入"
                                       icon="ios-search" :readonly="true"/>
                            </div>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label="车型" prop="modelName" class="iconsearch_style">
                            <div  @click="tagSearch">
                                <Input v-model="optionForm.modelName" :disabled="(isdisabled&&diffType=='details')||isReconsider" placeholder="点击款式查询后自动带入"
                                       icon="ios-search" :readonly="true"/>
                            </div>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <FormItem label="指导价" prop="guidePrice">
                            <Input v-model="optionForm.guidePrice"  :disabled="isdisabled||isReconsider"
                                   placeholder="点击款式查询后自动带入"/><span class="ml10">元</span>
                        </FormItem>
                    </Col>
                </Row>
                <Row>
                    <Col span="8">
                        <FormItem label="款式" prop="styleName" class="iconsearch_style  styleName">
                            <div style="width: calc(100% + 340px)" @click="tagSearch">
                                <Input v-model="optionForm.styleName" placeholder="点击款式查询后自动带入" :disabled="(isdisabled&&diffType=='details')||isReconsider"
                                       icon="ios-search" :readonly="true"/>
                            </div>
                        </FormItem>
                    </Col>
                </Row>
                <Row>
                    <Col span="8">
                        <FormItem label="车辆价格" prop="salePrice">
                            <Input v-model="optionForm.salePrice" @on-change="inputSalePrice(optionForm.salePrice)" :disabled="isShowDetails||diffType=='details'||isReconsider" /><span
                            class="ml10">元</span>
                        </FormItem>
                    </Col>
                    <Col span="8">
                        <place-cascade
                            :value="licenseValue"
                            :form="optionForm"
                            :label="licenseLabel"
                            :isDetailAddress="false"
                            :location="location"
                            :isShowDetails="isShowDetails"
                            :isReconsider="isReconsider"
                            :isAssertChange="isAssertChange"
                            :isNetLocation="isNetLocation"
                        ></place-cascade>
                    </Col>
                    <Col span="8">
                        <FormItem label="购买地点" prop="purchaseLocation" style="position: relative;">
                            <Cascader :load-data="loadData"
                                      :data="dynamicLocation.length>0?dynamicLocation:location"
                                      v-model="optionForm.purchaseLocation"
                                      style="padding-top: 4px;"
                                      :disabled="isShowDetails||isAssertChange||isReconsider"
                            >
                            </Cascader>
                        </FormItem>
                    </Col>
                </Row>
            </div>
        </div>
    </div>
</template>
<script>
    import PlaceCascade from "@/components/place-cascade"
    import {
        noDealerGetAddressList
    } from '_p/afs-apply/api/apply-report/personal/businessOption.js'
    import {getLocation} from "_p/afs-apply/api/apply-report/personal/common.js"

    export default {
        name: "newCar",
        data() {
            return {
                licenseLabel: "上牌地点",
                licenseValue: "licenseLocation",

                //  purchaseLabel:"购买地点",
                //  purchaseValue:"purchaseLocation",
                isdisabled: true,
            }
        },
        props: {
            isAssertChange:{
                type: Boolean,
            },
            isReconsider:{
                type: Boolean,
            },
            optionForm: {
                type: Object,
                require: true
            },
            location: {
                type: Array,
                require: true
            },
            isShowDetails: {
                type: Boolean,
            },
            dynamicLocation: {
                type: Array,
            },
            isNetLocation: {
                type: Boolean
            },
            pageIdentify:{
                type:String
            },
            diffType:{
                type:String
            }
        },
        components: {
            PlaceCascade,
        },
        mounted() {
        },
        methods: {
            tagSearch() {
                if (!this.isShowDetails&&this.diffType!='details'&&!this.isReconsider) {
                    this.$emit('queryVehicleData')
                }
            },
            //保存新车的资产信息
            save(type) {
                this.$emit('saveCapitalInfo', type)
            },
            loadData(item, callback) {
                this.$emit('loadDataAddress', item, callback);
            },
            inputSalePrice(val){
                if(this.pageIdentify=='assertChange'){
                    this.$emit('changeSalePrice',val,true)
                }

            },
        }
    }
</script>
<style scoped>
    .iconsearch_style >>> .ivu-icon-ios-search:before {
        font-size: 18px;
    }
     /* /deep/ .ivu-input.ivu-input-small.ivu-input-disabled{
        background-color: #f3f3f305;
    } */
</style>
